Ext.define('XTFrame.controller.ruiyuan.Introduction', {
	extend: 'Ext.app.Controller',
	init: function(){
		this.control({
			'ruiyuanIntroduction button[action=saveContent]': {
				click: function (o){
					var params = o.up('panelBorder').params;
					if(Ext.isEmpty(params)){
						Ext.xtframe.msg("提示", "保存失败！");
						return;
					}
					var content = o.up('ruiyuanIntroduction').down('xtframeIframe').iframe.getContent();
					var data = ajaxUtil.executeUpdate("ruiyuan_news_2", {col_id:params.col_id, content:content});
					if(ajaxUtil.isSucceed(data)){
						Ext.xtframe.msg("提示", "保存成功！");
					} else {
						Ext.xtframe.msg("提示", "保存失败！");
					}
				}
			},
			'ruiyuanIntroduction button[action=clearContent]': {
				click: function (o){
					o.up('ruiyuanIntroduction').down('xtframeIframe').iframe.setContent('');
				}
			},
			'ruiyuanIntroduction xtframeIframe': {
				iframeOnload: function (o){
					var params = o.up('panelBorder').params;
					if(Ext.isEmpty(params) || params==null){
						Ext.xtframe.msg("提示", "内容加载失败！");
						return;
					}
					var data = ajaxUtil.executeQuery("ruiyuan_news_1", {col_id:params.col_id});
					if(ajaxUtil.isSucceed(data)){
						o.iframe.setContent(data.arrData[0].content);
					} else {
						Ext.xtframe.msg("提示", "内容加载失败！");
					}
				}
			}
		});
	}
});